package com.steakliu.sun.protocol;


/**
 * 功能说明： 消息累心
 * <p>
 * Original @Author: steakliu-刘牌, 2023-01-08  00:48
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public enum MsgType {
    //请求
    REQUEST(1),
    //响应
    RESPONSE(2),
    //来自客户端发送的客户端心跳
    CLIENT_HEARTBEAT(3),
    //来自服务端发送的心跳
    SERVER_HEARTBEAT(4),
    //来自服务端响应的心跳信息
    SERVER_RESPONSE_HEARTBEAT(5),
    //来自客户端响应的心跳信息
    CLIENT_RESPONSE_HEARTBEAT(6);

    private int type = 1;

    MsgType(int type) {
        this.type = type;
    }

    public static MsgType findType(int type) {
        for (MsgType msgType : MsgType.values()) {
            if (msgType.getType() == type) {
                return msgType;
            }
        }
        return null;
    }

    public int getType() {
        return type;
    }
}
